package com.xlserver.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xlserver.util.model.UserInfo;
import lombok.Data;

import java.util.Map;
import java.util.Random;

@Data
@TableName("user_info")
public class User {
    @TableId("uid")
    private Integer userId;

    @TableField("uName")
    private String username;

    @TableField("uPhoneNumber")
    private String phoneNumber;

    @TableField("uEmergencyContactName")
    private String emergencyContactName;

    @TableField("uEmergencyContactPhoneNumber")
    private String emergencyPhoneNumber;

    @TableField("uGender")
    private int gender;

    @TableField("uAge")
    private int age;

    @TableField("uProfilePhoto")
    private String profilePhoto;

    @TableField("uForbidden")
    private int isForbidden;

    @TableField("uAccessDate")
    private String accessDate;

    public User(UserInfo info){
        this.emergencyContactName = info.getEmergencyContactName();
        this.emergencyPhoneNumber = info.getEmergencyContactPhoneNumber();
        this.phoneNumber = info.getPhoneNum();
        //这里的格式转换待定
//        this.profilePhoto = info.getPhotoAddress();
        this.username = info.getName();
    }

    public User(Integer userId,
                String username,
                String emergencyContactName,
                String emergencyPhoneNumber,
                int gender,
                int age,
                String profilePhoto) {
        this.userId = userId;
        this.username = username;
        this.emergencyContactName = emergencyContactName;
        this.emergencyPhoneNumber = emergencyPhoneNumber;
        this.gender = gender;
        this.age = age;
        this.profilePhoto = profilePhoto;
    }

    public User(Integer userId, String username, String phoneNumber, String emergencyContactName, String emergencyPhoneNumber, int gender, int age, String profilePhoto) {
        this.userId = userId;
        this.username = username;
        this.phoneNumber = phoneNumber;
        this.emergencyContactName = emergencyContactName;
        this.emergencyPhoneNumber = emergencyPhoneNumber;
        this.gender = gender;
        this.age = age;
        this.profilePhoto = profilePhoto;
    }

    public User(Integer userId, String username, String phoneNumber, String emergencyContactName, String emergencyPhoneNumber, int gender, int age, String profilePhoto, int isForbidden, String accessDate) {
        this.userId = userId;
        this.username = username;
        this.phoneNumber = phoneNumber;
        this.emergencyContactName = emergencyContactName;
        this.emergencyPhoneNumber = emergencyPhoneNumber;
        this.gender = gender;
        this.age = age;
        this.profilePhoto = profilePhoto;
        this.isForbidden = isForbidden;
        this.accessDate = accessDate;
    }
}
